import { createApp } from 'vue'
import App from './App.vue'
import ElementPlus from 'element-plus'
import 'element-plus/theme-chalk/index.css' // 引入element-plus的样式
import router from "@/router"
import "bootstrap"
import "bootstrap/dist/css/bootstrap.css"
import * as ElementPlusIconsVue from '@element-plus/icons-vue'
import store from './store'


const app = createApp(App)
// 全局注册el-icon
for (const [name, component] of Object.entries(ElementPlusIconsVue)) {
    app.component(name, component);
}

app.use(router).use(ElementPlus).use(store).mount('#app')

// 全局路由守卫
// router.beforeEach((to, from, next) => {
//     let token = sessionStorage.getItem('user')
//     if (to.meta.needLogin) { // 判断该路由是否需要登录权限
//         if (token) { // 判断是否已经登录
//             next()
//         }
//         else {
//             next({path: '/login'}) //跳转到登录页
//         }
//     } else {
//         next()
//     }
// })
